from pydantic import BaseModel
from typing import List, Optional
from .types import ParameterMapping



class ParameterMappingService:
    def __init__(self, mappings: List[ParameterMapping]):
        self.mappings = mappings

    def find_mapping_source(self, dst_operator_name, dst_param_name) -> Optional[ParameterMapping]:
        for mapping in self.mappings:
            if mapping.dst_operator_graph_id == dst_operator_name and mapping.dst_param_name == dst_param_name:
                return mapping
        return None 

    def get_mappings(self) -> List[ParameterMapping]:
        return self.mappings